<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JS</title>
</head>
<body>
    <!--<div onclick="alert('hello js')">
        这是一个段落，请点击我
    </div>-->
    <script>
        //alert('hello')
    </script>
    <!--<script src="text.js"></script>-->
    <script>
        //console.log('hello world');
        //var a=1022;
        //console.log(a);
        //let c=1000;
    </script>
    <script>
        /*let a=10;
        console.log(a);
        a='hello';
        console.log(a);*/
    </script>
    <script>
        /*let u=10;
        let c='10'
        console.log(u==c);*/
    </script>
    <script>
        //数组
        /*let arr=new Array();//法一
        let arr2=[];//常见写法
        let arr3=[1,2,3,4]
        let arr4=[1,'hello',true];
        console.log(arr4);
        console.log(arr3[1]);*/
    </script>
    <script>
        let arr=['1号','2号','3号'];
        console.log(arr);
        arr.push('9号');

        arr.splice(2,1);
        for (let i = 0; i< arr.length; i++) {
          console.log(arr[i]);
        }
        for(let i in arr){
            //此处i为下标
            console.log(arr[i]);
        }
        for(elem of arr){
            //elem为数组元素
            console.log(elem);
        }

    </script>
    <script>
        let a=20;
        function printf_a(num){
            console.log(num);
            return num;
        }
        printf_a(a);
        let n=printf_a(a);
    </script>
    <script>
        let bcc=10;
        function add(a,b){
            return a+b;
        }
        er=add(10,'uiLO');
        console.log(er);
    </script>
    <script>
        let result=0
        function op(){
            for(let elem of arguments){
                result=elem;
                console.log(elem);
                console.log(result);
            }
        console.log(op(12,2));
        }
    </script>


</body>
</html>